package com.wangyadong.hobby.schedule.jobtask;

import java.util.LinkedList;

/**
 * @ClassName LinkedListStack
 * @Description TODO
 * @Authpr Antonio
 * @Data 2018-06-06 21:58
 */
public class LinkedListStack<E> implements Stack<E> {
    private LinkedList<E> linkedList = new LinkedList();

    @Override
    public int size() {
        return linkedList.size();
    }

    @Override
    public boolean isEmpty() {
        return linkedList.isEmpty();
    }

    @Override
    public void push(E o) {
        linkedList.addFirst(o);
    }

    @Override
    public E top() {
        return (E) linkedList.getFirst();
    }

    @Override
    public E pop() {
        return (E) linkedList.removeFirst();
    }
}
